<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/8/21
 * Time: 11:00
 */

namespace app\index\controller;

use think\Db;
use think\Exception;

class Sync
{
    public function op()
    {
        $time = time();
        $date = Date('Y-m-d', $time);
        $hour = Date('H', $time);
        if ($hour == '23') {
            $date = Date('Y-m-d', strtotime("$date +1 day"));
        }
        try {
//            echo DB::execute(insertProductSql($date));
//            echo DB::execute(insertSiteProductSql($date));
            DB::execute(insertBillSql($date, 2));
        } catch (Exception $e) {
            echo $e->getMessage();
        }
        return 'DONE';
    }

    public function test()
    {
        return 'WTF';
    }
}